package com.ifeng.core.config;

import com.ifeng.core.contextHolder.DbContextHolder;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * <pre></pre>
 *
 * @author liwei
 * @date 2020-12-24 15:04
 */
public class DynamicDataSource extends AbstractRoutingDataSource {
    /**
     * 当前使用哪个数据源
     * @return
     */
    @Override
    protected Object determineCurrentLookupKey() {
        return DbContextHolder.getDbType();
    }
}
